﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mkHtmlProcess
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryInfo TheFolder = new DirectoryInfo("../../../../KeepPwd2/assets/mk");

            string res = "";
            if (TheFolder.Exists)
            {
                var files = TheFolder.GetFiles("*.html");
                foreach (var item in files)
                {
                    res += "htmlcache['../mk/" + item.Name + "']='";

                    StreamReader sr = new StreamReader(item.FullName);

                    string mk = sr.ReadToEnd();

                    //mk=mk.Replace("<head>", "$$theHEAD##").Replace("</head>", "$$theHEADEND##").Replace("<body>", "$$theBODY##").Replace("</body>", "$$theBODYEND##");
                    mk = mk.Replace("\r", "").Replace("\n", "").Replace("'", "\\'");

                    res += mk+"';\r\n";

                    sr.Close();
                    sr.Dispose();

                }
            }

            StreamWriter sw = new StreamWriter("res.txt", false);
            sw.Write(res);
            sw.Close();
            sw.Dispose();
        }
    }
}
